function sel_onclick(p_select_obj,p_hidden_obj) {
	p_hidden_obj.value = p_select_obj.value ;
}
function sel_cate_onclick(p_select_obj,p_hidden_obj,p_fuseaction) {
	var $v = p_select_obj.value;
	if ($v == ''){
		p_hidden_obj.value = 0;
	}else{
		p_hidden_obj.value = $v;
	}	
	document.forms(0).fuseaction.value = p_fuseaction;
	document.forms(0).hdn_filter.value = '';
	document.forms(0).submit();
}
function show_dialog_all_item_onclick(p_goto_url,p_fuseaction, p_text_name_obj, p_text_code_obj, p_hdn_obj, p_hdn_unit_id){
	v_url =  p_goto_url + "?hdn_handle_agency_id="+p_hdn_unit_id + "&fuseaction=" + p_fuseaction + "&modal_dialog_mode=1" + "&" + randomizeNumber();
	sRtn = showModalDialog(v_url,"","dialogWidth=420pt;dialogHeight=280pt;dialogTop=80pt;status=no;scroll=no;");
	if (!sRtn) return;
	arr_value = sRtn.split(_LIST_DELIMITOR);
	p_hdn_obj.value = arr_value[0];
	p_text_code_obj.value = arr_value[1];		
	p_text_name_obj.value = arr_value[2];
}

function btn_save_recordtype_onclick(p_recordtype_checkbox_obj,p_hdn_recordtype_checkbox_obj,p_fuseaction){
	p_hdn_recordtype_checkbox_obj.value = checkbox_value_to_list(p_recordtype_checkbox_obj,"!&~$*");
	btn_save_onclick(p_fuseaction);
}
/////Begin/////Cac ham phuc vui cho checkbox multiple
function show_row_selected(rad_id,tr_name){
	//Thay doi selected cua radio button
	eval('document.all.' + rad_id + '(0).checked=false');
	eval('document.all.' + rad_id + '(1).checked=true');
	//hide cac dong chua modul neu tr_name='tr_function' va gia tri cua checked=""
	if (tr_name == 'tr_function'){
		v_count=eval('document.all.tr_modul.length');
		if (v_count){
			for(var i=0;i<v_count;i++){
				if (eval('document.all.tr_modul[i].checked == ""')){
					eval('document.all.tr_modul[i].style.display="none"');
				}else{
					eval('document.all.tr_modul[i].style.display="block"');
				}
			}
		}else{
			if (eval('document.all.tr_modul.checked == ""')){
				eval('document.all.tr_modul.style.display="none"');
			}else{
				eval('document.all.tr_modul.style.display="block"');
			}
		}
	}
	//hide cac dong tr_name neu gia tri checked=""
	v_count=eval('document.all.' + tr_name + '.length');
	var v_odd_class="";
	if(v_count){
		for(var i=0;i<v_count;i++){
			if (eval('document.all.' + tr_name + '[i].checked == ""')){
				eval('document.all.' + tr_name + '[i].style.display="none"');
			}else{
				if (v_odd_class == "odd_row"){
					eval('document.all.'+ tr_name + '[i].className="round_row"');
					v_odd_class = "round_row"
				}else{
					eval('document.all.'+ tr_name + '[i].className="odd_row"');
					v_odd_class = "odd_row"
				}
			}
		}
	}else{
		if (eval('document.all.' + tr_name + '.checked == ""')){
			eval('document.all.' + tr_name + '.style.display="none"');
		}else{
			if (v_odd_class == "odd_row"){
				eval('document.all.'+ tr_name + '.className="round_row"');
				v_odd_class = "round_row"
			}else{
				eval('document.all.'+ tr_name + '.className="odd_row"');
				v_odd_class = "odd_row"
			}
		}
	}
}
//Ham show_all_row co chuc nang hien thi tat ca doi tuong (ke ca khong thuoc nhom)
function show_row_all(rad_id,tr_name){
	//Thay doi selected cua radio button
	eval('document.all.' + rad_id + '(0).checked=true');
	eval('document.all.' + rad_id + '(1).checked=false');
	//show tat ca cac tr_modul neu tr_name='tr_function'
	if (tr_name == 'tr_function'){
		v_count=eval('document.all.tr_modul.length');
		if(v_count){
			for(var i=0;i<v_count;i++){
				var v_img_path = getImgDirectory(eval('document.all.img_modul[i].src'));
				eval('document.all.img_modul[i].src = v_img_path + "open.gif"');
				eval('document.all.tr_modul[i].style.display="block"');
			}
		}else{
			eval('document.all.tr_modul.style.display="block"');
		}
	}
	//show tat ca cac tr_name
	v_count=eval('document.all.' + tr_name + '.length');
	var v_odd_class="";
	if(v_count){
		for(var i=0;i<v_count;i++){
			eval('document.all.' + tr_name + '[i].style.display="block"');
			if (v_odd_class == "odd_row"){
				eval('document.all.'+ tr_name + '[i].className="round_row"');
				v_odd_class = "round_row"
			}else{
				eval('document.all.'+ tr_name + '[i].className="odd_row"');
				v_odd_class = "odd_row"
			}
		}
	}else{
		eval('document.all.' + tr_name + '.style.display="block"');
		if (v_odd_class == "odd_row"){
			eval('document.all.'+ tr_name + '.className="round_row"');
			v_odd_class = "round_row"
		}else{
			eval('document.all.'+ tr_name + '.className="odd_row"');
			v_odd_class = "odd_row"
		}
	}
}
/*Ham change_item_checked
Chuc nang: Xu ly khi NSD click mouse vao checkbox cua EndUser hoac cua Function
	-Tim tr_name chua checkbox duoc click va thay doi trang thai cua attribute checked ("" hoac "checked")
	-Kiem tra cac trang thai checked cua cac function trong modul de xac dinh trang thai checked cua modul
	(Neu khong co function nao duoc chon thi checked=""; neu co thi checked="checked")
	-Kiem tra che do hien thi (qua radio button) de refresh lai man hinh
Tham so:
	-chk_obj: doi tuong checkbox duoc click
	-tr_name: ten id cua row chua checkbox (tr_function hoac tr_enduser)
	-rad_id:  ten id cua radio button xac dinh che do hien thi cua moi loai (rad_group_enduser hoac rad_group_function)
*/
function change_item_checked(chk_obj,tr_name,rad_id){
	var v_count;
	var i;
	var v_modul_checked=false;
	//Tim row chua checkbox va thay doi gia tri cua tr_name.checked
	v_count = eval('document.all.' + tr_name +'.length');
	i=0;
	if (v_count){
		while (i<v_count){
			if (eval('document.all.' + tr_name + '[i].value == chk_obj.value')){
				if (eval('document.all.' + tr_name + '[i].checked == "checked"')){
					eval('document.all.' + tr_name + '[i].checked = ""');
				}else{
					eval('document.all.' + tr_name + '[i].checked = "checked"');
				}
				//break;
			}
			//Kiem tra xem trong mo dul co chuc nang nao duoc chon khong
			if (tr_name == 'tr_function'){
				if (eval('document.all.' + tr_name + '[i].modul == chk_obj.modul')){
					if (eval('document.all.' + tr_name + '[i].checked == "checked"')){
						v_modul_checked=true;
					}
				}
			}
			i++;
		}
	}else{
		if (eval('document.all.' + tr_name + '.value == chk_obj.value')){
			if (eval('document.all.' + tr_name + '.checked == "checked"')){
				eval('document.all.' + tr_name + '.checked = ""');
			}else{
				eval('document.all.' + tr_name + '.checked = "checked"');
			}
		}
		if (tr_name == 'tr_function'){
			if (eval('document.all.' + tr_name + '.modul == chk_obj.modul')){
				if (eval('document.all.' + tr_name + '.checked == "checked"')){
					v_modul_checked=true;
				}
			}
		}
	}
	//thay doi gia tri cua checked trong tr_modul va chk_modul_id theo v_modul_checked=True or False
	if (tr_name == 'tr_function'){
		v_count = eval('document.all.tr_modul.length');
		if (v_count){
			i=0;
			while (i<v_count){
				if (eval('document.all.tr_modul[i].value == chk_obj.modul')){
					if (v_modul_checked == true){
						eval('document.all.tr_modul[i].checked = "checked"');
						eval('document.all.chk_modul_id[i].checked = "checked"');
					}else{
						eval('document.all.tr_modul[i].checked = ""');
						eval('document.all.chk_modul_id[i].checked = ""');
					}
					break;
				}
				i++;
			}
		}else{
			if (eval('document.all.tr_modul.value == chk_obj.modul')){
				if (v_modul_checked == true){
					eval('document.all.tr_modul.checked = "checked"');
				}else{
					eval('document.all.tr_modul.checked = ""');
				}
			}
		}
	}
	//Kiem tra che do hien thi de refresh man hinh
	if (eval('document.all.' + rad_id + '(1).checked')){
		show_row_selected(rad_id,tr_name);
	}
}
function save_hidden_list_item_id(p_hdn_list,p_chk_obj){
	p_hdn_list.value = checkbox_value_to_list(p_chk_obj,",");
}
function show_modal_dialog_unit_treeview_onclick(p_goto_url,p_fuseaction, p_text_name_obj, p_text_code_obj, p_hdn_obj, p_hdn_owner_id,p_height,p_width,p_allow_editing_in_modal_dialog,p_allow_select){
	if (!p_height) p_height = "280pt";
	if (!p_width) p_width = "450pt";
	if (!p_allow_editing_in_modal_dialog) v_allow_editing_in_modal_dialog = 0; else v_allow_editing_in_modal_dialog = p_allow_editing_in_modal_dialog;
	v_url = _DSP_MODAL_DIALOG_URL_PATH;
	v_url = v_url + "?goto_url=" + p_goto_url + "&hdn_item_id="+p_hdn_owner_id + "&fuseaction=" + p_fuseaction + "&modal_dialog_mode=1" 
	if (v_allow_editing_in_modal_dialog==1)
		v_url = v_url + "&allow_editing_in_modal_dialog=1";

	v_url = v_url+ "&" + randomizeNumber();
	sRtn = showModalDialog(v_url,"","dialogWidth="+p_width+";dialogHeight="+p_height+";dialogTop=80pt;status=no;scroll=no;");
	if (!sRtn) return;
	arr_value = sRtn.split(_LIST_DELIMITOR);
	p_hdn_obj.value = arr_value[0];
	p_text_code_obj.value = arr_value[1];		
	p_text_name_obj.value = arr_value[2];
}

function n_dsp_list_all_staff(){
	if (document.all.txt_handle_agency.value ==''){
		document.all.tr_list_all_staff.style.display="none";
	}else
		document.all.tr_list_all_staff.style.display="block";
}
function call_if_handler_list(p_hdn_agency_id,p_hdn_list_handler_id){
	url = "index.php?fuseaction=DISPLAY_ALL_STAFF_BY_AGENCY&p_agency_id="+p_hdn_agency_id+"&p_list_handler_id="+p_hdn_list_handler_id;
	url = url + "&modal_dialog_mode=1&allow_editing_in_modal_dialog=1";
	document.getElementById("if_handler_list").src=url;
	n_dsp_list_all_staff();
}
//nieuvv--121108--hien thi danh sach can bo phoi hop thu ly
function call_if_handler_co_list(p_hdn_agency_co_id,p_hdn_list_handler_co_id){
	url = "index.php?fuseaction=DISPLAY_ALL_STAFF_CO_BY_AGENCY&p_agency_co_id="+p_hdn_agency_co_id+"&p_list_handler_co_id="+p_hdn_list_handler_co_id;
	url = url + "&modal_dialog_mode=1&allow_editing_in_modal_dialog=1";
	document.getElementById("if_handler_list_co").src=url;
	n_dsp_list_all_staff_co();
}
function n_dsp_list_all_staff_co(){
	if (document.all.txt_handle_co_agency.value ==''){
		document.all.tr_list_all_staff_co.style.display="none";
	}else
		document.all.tr_list_all_staff_co.style.display="block";
}
//the-end-nieuvv-121108--
////////////////////////////////////
function delete_hande_approve_leader(obj_hdh,obj_txt){
	obj_hdh.value = 0;
	obj_txt.value = "";
}